package com.itfreer.data.metadata.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

import com.itfreer.form.api.entity.EntityBase;
import com.itfreer.form.api.reflect.DictionaryField;

/**
 * 定义数据定义子表实体
 */
@Entity(name = "data_definition_sub")
public class DataDefinitionSubEntity extends EntityBase implements Serializable {

	private static final long serialVersionUID = -8443497714033818376L;

	/**
	 * 主键
	 */
	@Id
	@Column(name = "id", length = 50, nullable = true)
	private String id;

	/**
	 * 父ID
	 */
	@Column(name = "pid", length = 50, nullable = true)
	private String pid;

	/**
	 * 子表ID
	 */
	@Column(name = "s_defid", length = 50, nullable = true)
	@DictionaryField(dictionaryName = "g_data_definition", toFieldName = "defName")
	private String defID;

	/**
	 * 子表名称
	 */
	@Transient
	private String defName;

	/**
	 * 外键
	 */
	@Column(name = "s_foreignkey", length = 50, nullable = true)
	private String foreignKey;

	/**
	 * 排序值
	 */
	@Column(name = "i_order", nullable = true)
	private Integer order;

	/**
	 * 主键
	 */
	public void setId(String value) {
		this.id = value;
	}

	public String getPid() {
		return pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	/**
	 * 排序值
	 */
	public void setOrder(Integer value) {
		this.order = value;
	}

	/**
	 * 主键
	 */
	public String getId() {
		return id;
	}

	/**
	 * 排序值
	 */
	public Integer getOrder() {
		return order;
	}

	public String getDefID() {
		return defID;
	}

	public void setDefID(String defID) {
		this.defID = defID;
	}

	@Transient
	public String getDefName() {
		return defName;
	}

	public void setDefName(String defName) {
		this.defName = defName;
	}

	public String getForeignKey() {
		return foreignKey;
	}

	public void setForeignKey(String foreignKey) {
		this.foreignKey = foreignKey;
	}

}